package kook.propeorties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.nio.charset.Charset;
import java.util.Objects;

@Component
@ConfigurationProperties(prefix = "message-forward")
@Data
public class MessageForwardProperties {
    private Game game;
    private Mxdbot mxdbot;

    @Data
    public static class Game {
        private boolean enable;
        private String address;
        private String charset;
        private int type;
        private String template;

        public void setCharset(String charset) {
            this.charset = Charset.forName(Objects.toString(charset), Charset.defaultCharset()).name();
        }
    }

    @Data
    public static class Mxdbot {
        private boolean enable;
        private String address;
        private String template;
    }
}


